//----------------------------------------------------------------------------
// M A R I T I M E  R E S E A R C H  I N S T I T U T E  N E T H E R L A N D S
//----------------------------------------------------------------------------
// Copyright (C) 2008 - MARIN - All rights reserved - http://www.marin.nl
//----------------------------------------------------------------------------
// Program    : mermaid
// Module     : vbm
// File       : FloatUtils.h
//----------------------------------------------------------------------------

#ifndef FLOATUTILS_H
#define FLOATUTILS_H

#include <math.h>

/// some necessary floating point routines
namespace FloatUtils
{
/// returns x squared

inline double square(double x)
{
    return x * x;
}

/// returns x to the third power

inline double third(double x)
{
    return x * x * x;
}

/// transfers sign of b to a (~ Fortran90 function)

inline double sign(double a, double b)
{
    return (b < 0 ? -fabs(a) : fabs(a));
}

double power(double base, double exponent);

double modulo(double a, double b);

double randomNumber(bool gauss);

}



#endif // FLOATUTILS_H
